package com.dragon.design.principle.openclose;

/**
 * 软件设计模式的基石:开闭原则,对扩展开放,对修改关闭,不要改变原有代码,但是可以对原有代码进行扩展
 *
 * @author dragon
 * @version V1.0.0-RELEASE
 * @date 2019/5/15 11:10
 */
public class Test {

    public static void main(String[] args) {
        Course course = new JavaDiscountCourse(1L, "java设计模式", 388.0);
        JavaDiscountCourse javaDiscountCourse = (JavaDiscountCourse) course;
        Double javaDiscountPrice = javaDiscountCourse.getDiscountPrice();
        System.out.println("课程的id:" + course.getId() + "课程的名称:" + course.getName() + "课程的原价" +
                course.getPrice() + "课程的折扣价格:" + javaDiscountCourse.getDiscountPrice());
    }
}
